package com.example.spinner;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class MainActivity extends AppCompatActivity {

    private Spinner main_sn_sensor;

    String sensor[] = {"温度","湿度","光照","人体"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        main_sn_sensor = findViewById(R.id.main_sn_sensor);

        ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.aa, R.id.test, sensor);
        main_sn_sensor.setAdapter(adapter);
        
    }
}